﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Bridge.EFCoreMigration.Shared.Migrations.wms
{
    /// <inheritdoc />
    public partial class wmsinit : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_agencyproduct",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OtherName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "别名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Specification = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ModelContent = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "型号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ManufactureId = table.Column<Guid>(type: "char(100)", maxLength: 100, nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    UseUnit = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true, comment: "计量单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PurcPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "采购单价"),
                    SellPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "销售单价"),
                    RaisePrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "院内加价"),
                    MinPackUnit = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true, comment: "最小包装单位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MinPackCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "最小包装数量"),
                    MinPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "最小包装单价"),
                    MidPackUnit = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true, comment: "中包装单位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MidPackCount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "中包装数量"),
                    MidPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "中包装单价"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<Guid>(type: "char(100)", maxLength: 100, nullable: true, comment: "产品大类标识", collation: "ascii_general_ci"),
                    ProductMinClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品小类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMinClassId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品小类标识")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsActive = table.Column<int>(type: "int", nullable: false, comment: "是否启用  0-禁用 1-启用"),
                    RegisteredCardCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "注册证号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WinningPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "中标价"),
                    WinningCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "中标号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EnglishName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "英文名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UidCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "Uid码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HealthCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "医保代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HealthClassCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "医保分类代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsAsepticPack = table.Column<int>(type: "int", nullable: false, comment: "是否无菌包装  0:否, 1:是"),
                    IsNeedSterilization = table.Column<int>(type: "int", nullable: false, comment: "是否需要灭菌 0:否, 1:是"),
                    SterilizationWay = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "灭菌方式")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductPictureUrl = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true, comment: "产品图片url")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DrugTradeId = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "药交id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MnemCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "助记码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_agencyproduct", x => x.Id);
                },
                comment: "产品")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_allotvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    InDeptId = table.Column<Guid>(type: "char(36)", maxLength: 36, nullable: false, comment: "调入科室Id", collation: "ascii_general_ci"),
                    InDeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "调入科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutDeptId = table.Column<Guid>(type: "char(36)", maxLength: 36, nullable: false, comment: "调出科室Id", collation: "ascii_general_ci"),
                    OutDeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "调出科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMethod = table.Column<int>(type: "int", nullable: false, comment: "产品管理方式 0数量管理，1定数管理"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_allotvoucher", x => x.Id);
                },
                comment: "调拨单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_allotvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    AllotCount = table.Column<decimal>(type: "decimal(10,4)", nullable: false, comment: "调拨数量"),
                    BarCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "唯一码(高值耗材专用)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码(高值耗材专用)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_allotvoucherdetail", x => x.Id);
                },
                comment: "调拨单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_consumevoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "消耗科室Id", collation: "ascii_general_ci"),
                    DeptName = table.Column<string>(type: "longtext", nullable: true, comment: "消耗科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperatId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "手术信息主键ID", collation: "ascii_general_ci"),
                    BillingNurse = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "计费护士")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMethod = table.Column<int>(type: "int", nullable: false, comment: "产品管理方式 0数量管理，1定数管理"),
                    VoucherType = table.Column<int>(type: "int", nullable: false, comment: "单据类型（0-普通消耗 1-计费消耗  2-手术套包消耗 3-手术跟台消耗（简易版) 4-手术跟台消耗（常规版）"),
                    SourceType = table.Column<int>(type: "int", nullable: false, comment: "来源系统（0-SPD  1-HIS  3-其他"),
                    IsCharging = table.Column<int>(type: "int", nullable: false, comment: "是否计费 空：未计费 0：计费失败 1：已计费"),
                    ChargeDeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "计费科室", collation: "ascii_general_ci"),
                    ChargeDeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "计费科室")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HospitalCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "住院号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MedicalCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PatientName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "患者姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DedsCode = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "床位号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PatientSex = table.Column<string>(type: "varchar(5)", maxLength: 5, nullable: true, comment: "性别")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PatientAge = table.Column<int>(type: "int", nullable: true, comment: "年龄"),
                    PatientIdNumber = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "患者身份证号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ManageBedDoctorId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "管床医生证件号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "手术单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "手术名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationDoctor = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "手术医生")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ChiefDoctor = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "开单医生")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "手术日期"),
                    InHospitalNumber = table.Column<int>(type: "int", nullable: true, comment: "住院次数"),
                    ChargeTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "计费时间"),
                    VoucherClass = table.Column<int>(type: "int", nullable: false, comment: "单据类型 (0-消耗单、1-消退单、2-损耗消耗单、3-损耗消退单)"),
                    BelongDeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "所属科室Id", collation: "ascii_general_ci"),
                    BelongDeptName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "所属科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DoctorDeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "医生所属科室Id", collation: "ascii_general_ci"),
                    DoctorDeptName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "医生所属科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsImplant = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否植入介入消耗单"),
                    HisChargeDeptCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "HIS开单科室编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HisChargeDeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "HIS开单科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HisExecDeptCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "HIS执行科室编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HisExecDeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "HIS执行科室编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrderSource = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "单据来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_consumevoucher", x => x.Id);
                },
                comment: "消耗单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_consumevoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    BarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "高值唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HisChargeId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "his计费id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_consumevoucherdetail", x => x.Id);
                },
                comment: "消耗单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_deptproduct",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "科室id", collation: "ascii_general_ci"),
                    ProductId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "机构产品id", collation: "ascii_general_ci"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductManageType = table.Column<int>(type: "int", maxLength: 100, nullable: false, comment: "管理方式 0数量管理 1定数管理"),
                    CancelVeriType = table.Column<int>(type: "int", maxLength: 100, nullable: false, comment: "消耗方式：0 手工消耗 1自动消耗"),
                    SettleType = table.Column<int>(type: "int", nullable: false, comment: "结算方式  0不结算，1仓库入库结算， 2科室收货结算 3科室消耗结算"),
                    IsAutoReple = table.Column<int>(type: "int", nullable: false, comment: "是否自动补货 0否 1是"),
                    StockUpper = table.Column<int>(type: "int", nullable: false, comment: "库存上限"),
                    StockLower = table.Column<int>(type: "int", nullable: false, comment: "库存下限"),
                    IsApplyAudit = table.Column<int>(type: "int", nullable: false, comment: "是否申请时审核"),
                    DefiniteNum = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "定数"),
                    IsEnable = table.Column<int>(type: "int", nullable: false, comment: "是否已保存(0.未保存 1.已保存)"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "删除标识"),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "租户ID", collation: "ascii_general_ci"),
                    IsConsumption = table.Column<int>(type: "int", nullable: false, comment: "是否以领代消(0否1是)"),
                    IsEnableExclusive = table.Column<int>(type: "int", nullable: false, comment: "是否启用专科专用(是:1 否:0)，默认0"),
                    IsCupboard = table.Column<int>(type: "int", nullable: false, comment: "是否入柜(是:1 否:0)，默认0"),
                    IsUnpack = table.Column<int>(type: "int", nullable: false, comment: "是否拆零三级库产品(是:1 否:0)，默认0"),
                    StockingCycle = table.Column<int>(type: "int", nullable: false, comment: "备货周期（天）"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
                    IsAutoReplenish = table.Column<sbyte>(type: "tinyint", nullable: false, comment: "是否开启自动补货"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_deptproduct", x => x.Id);
                },
                comment: "科室产品")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_flowstock",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RealationId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "关联单据明细ID", collation: "ascii_general_ci"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "部门编码id", collation: "ascii_general_ci"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "产品批号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutInCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "出入库数量（入库正数 出库负数）"),
                    OutInPrice = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "有效期"),
                    ShelfCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "货位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次跟踪码（供应商编码+入库单号+行号）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InStockVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "入库单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InStockCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "入库数量"),
                    OutInFlag = table.Column<int>(type: "int", nullable: false, comment: " 出入库标识：1-入库  2-出库 3-出入库"),
                    OutInType = table.Column<int>(type: "int", nullable: false, comment: "出入库类型：1-采购入库 2-采购退货  3-仓库出库 4-科室退库 5-科室消耗 6-科室消退 7-库房调拨 8-库房盘点 9-定数打包  10-定数拆包  11-入库冲销  12-手术套包组包  13-手术套包拆包"),
                    ProductMinClass = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品小类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "供应商Id", collation: "ascii_general_ci"),
                    StockId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "批次库存ID", collation: "ascii_general_ci"),
                    BeforeStockCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "操作前库存"),
                    AfterStockCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "操作过后库存"),
                    OutInTime = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "出入库时间"),
                    BarCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "套包编码或定数包条码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_flowstock", x => x.Id);
                },
                comment: "库存流水表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_instockvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    VoucherType = table.Column<int>(type: "int", nullable: false, comment: "单据类型 0 常规入库 1 直入直出"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "供应商ID", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "仓库Id", collation: "ascii_general_ci"),
                    WarehouseName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiveDeptId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "领用科室Id", collation: "ascii_general_ci"),
                    ReceiveDeptName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "领用科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMinClassId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "产品小类Id", collation: "ascii_general_ci"),
                    ProductMinClassName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "产品小类 名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Purchaser = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "采购员")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WarehousedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "验收人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WarehousedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "验收时间"),
                    ReinspectionBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "复验人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReinspectionOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "复验时间"),
                    AcceptanceOpinions = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "验收意见")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherClass = table.Column<int>(type: "int", maxLength: 50, nullable: false, comment: "入库类别(1-采购入库、2-捐赠入库、3-科研入库)"),
                    OrderVoucherId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    OrderVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    NoInStockReason = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "拒收原因")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ApplyOrderVoucherId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "申请单Id", collation: "ascii_general_ci"),
                    ApplyOrderVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "申请单编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ApplyDeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "申请科室Id", collation: "ascii_general_ci"),
                    ApplyDeptName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "申请科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsOperationHeel = table.Column<bool>(type: "tinyint(1)", nullable: true, comment: "是否骨科材料管理"),
                    SellVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "销售单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutStockVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "出库单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductManageType = table.Column<int>(type: "int", nullable: false, comment: "管理方式：0---数量管理; 1---定数管理"),
                    AgentId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "代理商Id", collation: "ascii_general_ci"),
                    AgentName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "代理商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AccountingStatus = table.Column<int>(type: "int", nullable: true, comment: "记账状态(0:未记账 1:已记账)"),
                    DocumentAnnex = table.Column<string>(type: "varchar(2000)", maxLength: 2000, nullable: true, comment: "入库单凭证")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ResearchMaterialsLeaderName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "科研负责人姓名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ResearchMaterialsLeaderId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "科研负责人ID", collation: "ascii_general_ci"),
                    ResearchMaterialsProjectId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "科研项目ID", collation: "ascii_general_ci"),
                    IsBarCodeDirect = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否是定数直入直出单；1：是，0：否"),
                    BackgroundStatus = table.Column<int>(type: "int", nullable: true, comment: "后台验收处理状态：0未处理，1处理中，2成功，3失败"),
                    BackgroundRemark = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "后台验收处理备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TagPrintStatus = table.Column<int>(type: "int", nullable: false, comment: "标签打印状态（0:未打印，1:部分打印，2:已打印）"),
                    RFIDPrintStatus = table.Column<int>(type: "int", nullable: false, comment: "RFID打印状态（0:未打印，1:部分打印，2:已打印）"),
                    IsRejectCount = table.Column<int>(type: "int", nullable: false, comment: "当前OMS提取入库单，是否存在驳回数量（0:否，1:是）"),
                    IsCollect = table.Column<int>(type: "int", nullable: false, comment: "是否集采 0-未集采，1-集采"),
                    SyncTimeStamp = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "时间戳字段"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_instockvoucher", x => x.Id);
                },
                comment: "入库单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_instockvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    InCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "入库数量"),
                    SupplierDeliveryNo = table.Column<string>(type: "longtext", nullable: true, comment: "配送单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SupplierDeliveryId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "配送明细ID", collation: "ascii_general_ci"),
                    OrderCode = table.Column<string>(type: "longtext", nullable: true, comment: "订单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsBarCodeControl = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否唯一码管控"),
                    ReceiveDeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "领用科室Id", collation: "ascii_general_ci"),
                    ReceiveDeptName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "领用科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_instockvoucherdetail", x => x.Id);
                },
                comment: "入库单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_lockstock",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    StockId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "批次库存ID", collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "longtext", nullable: true, comment: "锁住单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "科室Id", collation: "ascii_general_ci"),
                    ProductCode = table.Column<string>(type: "longtext", nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LockCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "锁定数量"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_lockstock", x => x.Id);
                },
                comment: "锁定批次库存表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_manufacturer",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ManufacturerCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "厂商统一社会信用代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EnterpriseType = table.Column<int>(type: "int", nullable: false, comment: "供应商企业类型:0供应商; 1生厂商; 2代理商"),
                    LegalPerson = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "法人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Province = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "省")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    City = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "市")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Area = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Address = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "商品类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BusinessDate = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    BusinessStart = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    BusinessEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    IslongTimeBusiness = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否长期经营"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_manufacturer", x => x.Id);
                },
                comment: "生厂商")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_ordervoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    WarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "仓库id", collation: "ascii_general_ci"),
                    WarehouseName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "供应商id", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiveAddress = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "配送地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_ordervoucher", x => x.Id);
                },
                comment: "订单主表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_ordervoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "部门编码", collation: "ascii_general_ci"),
                    DeptName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "部门名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OrderCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "订单数量"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_ordervoucherdetail", x => x.Id);
                },
                comment: "订单明细表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_outstockvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    VoucherType = table.Column<int>(type: "int", nullable: false, comment: "单据出库类型 0 一级仓库出库 1 二级科室出库"),
                    ProductManageType = table.Column<int>(type: "int", nullable: false, comment: "管理方式：0-数量管理 1-定数管理"),
                    InWarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: " 发货仓库", collation: "ascii_general_ci"),
                    InWarehouseName = table.Column<string>(type: "longtext", nullable: true, comment: "发货仓库")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OutWarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "领用仓库", collation: "ascii_general_ci"),
                    OutWarehouseName = table.Column<string>(type: "longtext", nullable: true, comment: "领用仓库")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiveAddress = table.Column<string>(type: "longtext", nullable: true, comment: "配送地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMinClassId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "产品小类标识", collation: "ascii_general_ci"),
                    ProductMinClassName = table.Column<string>(type: "longtext", nullable: true, comment: "产品小类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RecheckedBy = table.Column<string>(type: "longtext", nullable: true, comment: "复核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RecheckedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "复核时间"),
                    VoucherClass = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "出库类别(0-领用出库、1-捐赠出库、2-科研出库、3-无偿出库)")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_outstockvoucher", x => x.Id);
                },
                comment: "出库单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_outstockvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    OutCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "出库数量"),
                    DefineCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "定数"),
                    BarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "高值唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsBarCodeControl = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否唯一码管控"),
                    IsCharging = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否计费"),
                    IsCollect = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否采集"),
                    IsMonitored = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否重点监控"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "供应商ID", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_outstockvoucherdetail", x => x.Id);
                },
                comment: "出库单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_packvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    WarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "一级库ID", collation: "ascii_general_ci"),
                    WarehouseName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "一级库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "二级库ID", collation: "ascii_general_ci"),
                    DeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "二级库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_packvoucher", x => x.Id);
                },
                comment: "打包单主表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_packvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    PackageCount = table.Column<int>(type: "int", nullable: false, comment: "包数"),
                    ScatteCount = table.Column<decimal>(type: "decimal(10,2)", nullable: false, comment: "零散数量"),
                    DefiniteCount = table.Column<decimal>(type: "decimal(10,2)", nullable: false, comment: "定数"),
                    BarCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_packvoucherdetail", x => x.Id);
                },
                comment: "定数包打包明细表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_productclass",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    ClassCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "产品大类编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_productclass", x => x.Id);
                },
                comment: "产品大类")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_producttrackstock",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    DeptId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "科室ID", collation: "ascii_general_ci"),
                    DeptName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PackageCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "套包编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PackageName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "套包名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OperationName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "套包手术名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OtherName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品通用名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UseUnit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "计量单位名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MidPackCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "中包装数量"),
                    StockType = table.Column<int>(type: "int", nullable: false, comment: "库存类型（1-定数 2-套包 3-数量 4-骨科定数包）"),
                    DefiniteNum = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "定数数量"),
                    StockCount = table.Column<decimal>(type: "decimal(65,30)", nullable: false, comment: "库存数量"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品批号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProducttClassId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "产品大类ID", collation: "ascii_general_ci"),
                    ProductMinClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品小类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductMinClassId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "产品小类ID", collation: "ascii_general_ci"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ManufactureName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生产厂家")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ManufactureId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "生产厂家ID", collation: "ascii_general_ci"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "有效期"),
                    ShelfCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "货位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次跟踪码（供应商编码+入库单号+行号）")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InStockVoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "入库单号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InStockCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "入库数量"),
                    Specification = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "供应商ID", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BarCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "删除标识"),
                    SterilizationLot = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "灭菌批号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SterilizationExp = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "灭菌效期"),
                    UdiCode = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "唯一条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SerialNumber = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "序列号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsBarCodeControl = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否唯一码管控(0-否 1-是)"),
                    RegistrationNumber = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "注册证号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CheckStockProfitDetailID = table.Column<Guid>(type: "char(36)", nullable: true, comment: "盘盈盘亏明细ID", collation: "ascii_general_ci"),
                    IsReceive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否领用"),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_producttrackstock", x => x.Id);
                },
                comment: "产品批次库存表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_regressionVoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    DeptID = table.Column<Guid>(type: "char(36)", nullable: true, comment: "科室ID", collation: "ascii_general_ci"),
                    DeptName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "科室名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductManageType = table.Column<int>(type: "int", nullable: false, comment: "产品管理方式 0数量管理 1定数管理"),
                    WarehouseLevel = table.Column<int>(type: "int", nullable: false, comment: "仓库级别"),
                    Equipment = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "试剂上机设备")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AccountingStatus = table.Column<int>(type: "int", nullable: false, comment: "记账状态(0:未记账 1:已记账)"),
                    VoucherClass = table.Column<int>(type: "int", nullable: true, comment: "单据类型"),
                    OperationNur = table.Column<string>(type: "varchar(60)", maxLength: 60, nullable: true, comment: "计费人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    HisRetTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "退费时间"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_regressionVoucher", x => x.Id);
                },
                comment: "消退单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_regressionvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    BarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "高值唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    RegressionCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "数量"),
                    HisChargeId = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "his退费id")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_regressionvoucherdetail", x => x.Id);
                },
                comment: "消退单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_rejectstockvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "供应商ID", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    WarehouseId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "发货仓库Id", collation: "ascii_general_ci"),
                    WarehouseName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "发货仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductManageType = table.Column<int>(type: "int", nullable: false, comment: "管理方式：0-数量管理 1-定数管理"),
                    CreatorBy = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReturnReason = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "退货原因")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_rejectstockvoucher", x => x.Id);
                },
                comment: "退货单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_rejectstockvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    RejectCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "退货数量"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "高值唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_rejectstockvoucherdetail", x => x.Id);
                },
                comment: "退货单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_returnstockvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    VoucherType = table.Column<int>(type: "int", maxLength: 2, nullable: false, comment: "单据类型 1-二级库退库 2-三级库退库 3-三级库退一级库"),
                    DeptInId = table.Column<Guid>(type: "char(36)", maxLength: 36, nullable: true, comment: "入库 仓库", collation: "ascii_general_ci"),
                    DeptInName = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "入库 仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeptOutId = table.Column<Guid>(type: "char(36)", maxLength: 36, nullable: true, comment: "出库 仓库ID", collation: "ascii_general_ci"),
                    DeptOutName = table.Column<string>(type: "varchar(60)", maxLength: 60, nullable: true, comment: "出库 仓库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductManageType = table.Column<int>(type: "int", nullable: false, comment: "管理方式：0-数量管理 1-定数管理"),
                    ReturnReason = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "退库原因")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_returnstockvoucher", x => x.Id);
                },
                comment: "退库单")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_returnstockvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    RetCount = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "退库数量"),
                    SupplierId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "供应商Id", collation: "ascii_general_ci"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "条形码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    UdiCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "UDI编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    OnlyBarCode = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "高值唯一码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_returnstockvoucherdetail", x => x.Id);
                },
                comment: "退库单明细")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_supplier",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    SupplierCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "供应商编码-统一社会信用代码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SupplierName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "供应商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SpdSupplierCode = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "spd供应商编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MnemCode = table.Column<string>(type: "varchar(400)", maxLength: 400, nullable: true, comment: " 供应商助记码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    EnterpriseType = table.Column<int>(type: "int", nullable: true, comment: "供应商企业类型:0供应商; 1生厂商; 2代理商"),
                    LegalPerson = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: " 法人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Province = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: " 省")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    City = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "市")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Area = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "区")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Address = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "地址")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "商品类型")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsLock = table.Column<bool>(type: "tinyint(50)", maxLength: 50, nullable: false, comment: "供应商锁定状态"),
                    IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否启用"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    BusinessDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "成立日期"),
                    BusinessStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "营业开始时间"),
                    BusinessEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "营业截止时间"),
                    IslongTimeBusiness = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否长期经营"),
                    Contacts = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "联系人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ContactTel = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "联系电话")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DistributionDays = table.Column<int>(type: "int", nullable: false, comment: "配送天数"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_supplier", x => x.Id);
                },
                comment: "供应商")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_unpackvoucher",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    WarehouseId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "一级库ID", collation: "ascii_general_ci"),
                    WarehouseName = table.Column<string>(type: "longtext", nullable: true, comment: "一级库名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品大类名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductClassId = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: true, comment: "产品大类ID")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Remark = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "备注")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TotalCount = table.Column<decimal>(type: "decimal(10,2)", nullable: true, comment: "总数量"),
                    TotalAmount = table.Column<decimal>(type: "decimal(18,4)", nullable: true, comment: "总金额"),
                    IsPushHis = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否推送his 0-未推送 1-已推送"),
                    IsPrint = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "打印状态 0-未打印 1-已打印"),
                    Status = table.Column<int>(type: "int", nullable: false, comment: "0暂存 -1已作废 1已提交 2已驳回 3已审核"),
                    AuditOn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "审核时间"),
                    AuditBy = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "审核人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedBy = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "制单人")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedOn = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "制单时间"),
                    Source = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true, comment: "来源")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReasonRejection = table.Column<string>(type: "varchar(500)", maxLength: 500, nullable: true, comment: "驳回理由")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_unpackvoucher", x => x.Id);
                },
                comment: "拆包单主表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "t_unpackvoucherdetail",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    PackageCount = table.Column<decimal>(type: "decimal(10,2)", nullable: false, comment: "包数"),
                    ScatteCount = table.Column<decimal>(type: "decimal(10,2)", nullable: false, comment: "零散数量"),
                    DefiniteCount = table.Column<decimal>(type: "decimal(10,2)", nullable: false, comment: "定数"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    VoucherCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单据编号")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    VoucherId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "入库单Id", collation: "ascii_general_ci"),
                    VoucherLine = table.Column<int>(type: "int", nullable: false, comment: "行号"),
                    ProductCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "产品编码")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductName = table.Column<string>(type: "varchar(300)", maxLength: 300, nullable: true, comment: "产品名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Price = table.Column<decimal>(type: "decimal(18,4)", nullable: false, comment: "单价"),
                    Specification = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "规格")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Unit = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "单位")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductBatch = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "批次")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ProductDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "生产日期"),
                    ExpiryDate = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "有效期"),
                    ManufacturerId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "生厂商标识", collation: "ascii_general_ci"),
                    ManufacturerName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "生厂商名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TrackCode = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "跟踪码")
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_t_unpackvoucherdetail", x => x.Id);
                },
                comment: "定数包拆包明细表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_t_allotvoucher_VoucherCode",
                table: "t_allotvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_allotvoucherdetail_VoucherCode",
                table: "t_allotvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_consumevoucher_VoucherCode",
                table: "t_consumevoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_consumevoucherdetail_VoucherCode",
                table: "t_consumevoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_instockvoucher_VoucherCode",
                table: "t_instockvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_instockvoucherdetail_VoucherCode",
                table: "t_instockvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_ordervoucher_VoucherCode",
                table: "t_ordervoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_ordervoucherdetail_VoucherCode",
                table: "t_ordervoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_outstockvoucher_VoucherCode",
                table: "t_outstockvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_outstockvoucherdetail_VoucherCode",
                table: "t_outstockvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_packvoucher_VoucherCode",
                table: "t_packvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_regressionVoucher_VoucherCode",
                table: "t_regressionVoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_regressionvoucherdetail_VoucherCode",
                table: "t_regressionvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_rejectstockvoucher_VoucherCode",
                table: "t_rejectstockvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_rejectstockvoucherdetail_VoucherCode",
                table: "t_rejectstockvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_returnstockvoucher_VoucherCode",
                table: "t_returnstockvoucher",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_returnstockvoucherdetail_VoucherCode",
                table: "t_returnstockvoucherdetail",
                column: "VoucherCode");

            migrationBuilder.CreateIndex(
                name: "IX_t_unpackvoucher_VoucherCode",
                table: "t_unpackvoucher",
                column: "VoucherCode");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "t_agencyproduct");

            migrationBuilder.DropTable(
                name: "t_allotvoucher");

            migrationBuilder.DropTable(
                name: "t_allotvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_consumevoucher");

            migrationBuilder.DropTable(
                name: "t_consumevoucherdetail");

            migrationBuilder.DropTable(
                name: "t_deptproduct");

            migrationBuilder.DropTable(
                name: "t_flowstock");

            migrationBuilder.DropTable(
                name: "t_instockvoucher");

            migrationBuilder.DropTable(
                name: "t_instockvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_lockstock");

            migrationBuilder.DropTable(
                name: "t_manufacturer");

            migrationBuilder.DropTable(
                name: "t_ordervoucher");

            migrationBuilder.DropTable(
                name: "t_ordervoucherdetail");

            migrationBuilder.DropTable(
                name: "t_outstockvoucher");

            migrationBuilder.DropTable(
                name: "t_outstockvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_packvoucher");

            migrationBuilder.DropTable(
                name: "t_packvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_productclass");

            migrationBuilder.DropTable(
                name: "t_producttrackstock");

            migrationBuilder.DropTable(
                name: "t_regressionVoucher");

            migrationBuilder.DropTable(
                name: "t_regressionvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_rejectstockvoucher");

            migrationBuilder.DropTable(
                name: "t_rejectstockvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_returnstockvoucher");

            migrationBuilder.DropTable(
                name: "t_returnstockvoucherdetail");

            migrationBuilder.DropTable(
                name: "t_supplier");

            migrationBuilder.DropTable(
                name: "t_unpackvoucher");

            migrationBuilder.DropTable(
                name: "t_unpackvoucherdetail");
        }
    }
}
